home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / debugtx.arc / 03OPREQ.DOC < prev    next >
Encoding:
Text File  |  1991-08-11  |  12.6 KB  |  285 lines

  1. CHAPTER 3   OPERATION AND REQUIREMENTS                    3-1
  2.  
  3.  
  4. A86 Program Invocation
  5.  
  6. To invoke A86, you must provide a program invocation line, either 
  7. typed to the console when the DOS command prompt appears, or 
  8. included in a batch file.  The program invocation line consists 
  9. of the following: 
  10.  
  11. 1. The program name A86.
  12.  
  13. 2. The names of the source files you want to assemble.  You may 
  14.    use the wild-card delimiters * and ? if you wish, to denote a 
  15.    group of source files to be assembled.  A86 will sort all 
  16.    matching names into alphabetical order for each wild-card 
  17.    specification; so the files will be assembled in the same 
  18.    order even if they get jumbled up within a directory.  
  19.  
  20.    A86 identifies the end of the source file names when it sees a 
  21.    name with no extension, or a name with the default object-
  22.    extension (COM, BIN or OBJ, as described shortly).  Sorry, you 
  23.    cannot have a source file with the default object extension.  
  24.  
  25. 3. You may optionally provide the word TO, to separate the source 
  26.    file names from the output file names.  
  27.  
  28. 4. The name of the output program.  If you do not provide an 
  29.    extension, A86 will assume one of the following extensions:
  30.  
  31.      a. .OBJ if you invoked the +O switch, for linkable-object
  32.         file production.
  33.  
  34.      b. .BIN if there is no +O switch, but there is an ORG 0 in 
  35.         your program.
  36.  
  37.      c. .COM otherwise.
  38.  
  39.    If you want your program file to have no extension, you end 
  40.    the file name with a period.  
  41.  
  42.    You have the option to omit both the program file name and the 
  43.    symbol table file name from the invocation.  If you do so, A86 
  44.    will output the program source.COM (or source.OBJ or 
  45.    source.BIN) and the symbol table source.SYM; where "source" is 
  46.    a name derived from the list of source files, according to the 
  47.    rules described in the section "Strategies for Source File 
  48.    Maintenance" later in this chapter.  
  49.  
  50. 5. The name of the symbol-table file.  If you do not provide an 
  51.    extension, A86 will assume that you want the extension .SYM.  
  52.    If you want your symbol table file to have no extension, you 
  53.    end the file name with a period.  
  54.  
  55.    You have the option to omit the name of the symbol table file.  
  56.    If you do so, A86 will use the same root as the output program 
  57.    name, with a .SYM extension.  If you desire no symbol table 
  58.    file, specify the +S switch in your invocation line or A86 
  59.    environment variable.
  60.                                                           3-2
  61. Assembler Switches
  62.  
  63. In addition to input and output file names, you may intersperse 
  64. assembler switch-settings anywhere after the A86 program name.  
  65. They are all acted upon immediately, no matter where they are on 
  66. the command line.  Some of the switches are discussed in more 
  67. detail elsewhere; I'll summarize them here: 
  68.  
  69. +C  causes the assembler to output symbol names with lower-case 
  70.     letters to its OBJ and SYM files.  This gives you the 
  71.     capability of linking lower-case names with modules from a C 
  72.     compiler.  I have recently discovered that Microsoft's MASM 
  73.     assembler pays attention to the case of letters only for 
  74.     output, not during the assembly; so I now duplicate the 
  75.     functionality of MASM on this.  MASM's (undocumented) policy 
  76.     is to use the version of the symbol name as it appears in a 
  77.     PUBLIC or EXTRN directive.  I use the last such occurance if 
  78.     there is one; otherwise I use the first occurance of the 
  79.     symbol to control which letters are output lower-case. 
  80.     
  81.     There had been a distinction between +C and +c, to overcome a 
  82.     problem A86 had in recognizing built-in symbols.  The problem 
  83.     is now solved, so the distinction has been dropped. 
  84.  
  85. +D  causes the default base for numeric constants to be decimal, 
  86.     even if the constants have leading zeroes.
  87.  
  88. -D  causes the default base to be hexadecimal if there is a 
  89.     leading zero; decimal otherwise.
  90.  
  91. +E  causes the error-message-augmented source file to be written 
  92.     to yourname.ERR within the current directory, in all cases.  
  93.     With +E, A86 will never rewrite your original source file. 
  94.  
  95. -E  causes A86 to insert error messages into your source file,
  96.     whenever the file is in the current directory.  If the file 
  97.     is not in the current directory, A86 write an ERR file no 
  98.     matter what the E-switch setting is.
  99.  
  100. +F  causes A86 to generate the 287-form of floating-point 
  101.     instructions (no implicit FWAIT bytes are generated before 
  102.     the instructions).  This mode can also be specified in the 
  103.     program with the .287 directive.
  104.  
  105. +f  causes A86 to support emulation of the 8087.  When A86 sees a 
  106.     floating-point instruction, it generates external references 
  107.     to be resolved by the standard emulation library (provided by 
  108.     Microsoft, Borland, etc.).  When you LINK your program to the 
  109.     emulation library, the floating-point instructions are 
  110.     emulated by software.  NOTE you must be assembling to a 
  111.     linkable OBJ file for this mode to have effect; otherwise, +f 
  112.     is ignored.
  113.  
  114. -F  causes emulation and default-287 to be disabled.  You'll 
  115.     still get 287 generation if there is a .287 directive in your 
  116.     program.        
  117.                                                           3-3 
  118. +L  causes A86 to generate a longer (3-byte) instruction form 
  119.     for an unconditional JMP instruction to a forward-reference 
  120.     local labels, e.g. JMP >L1.  The code will usually be longer 
  121.     than necessary, but you'll be spared having to occasionally 
  122.     go back and code an explicit JMP LONG >L1.
  123.  
  124. -L  causes A86 to generate the more efficient 2-byte form for
  125.     JMP >L1.
  126.  
  127. +O  causes A86 to produce a linkable .OBJ file when the output 
  128.     file name extension is not explicitly given.
  129.  
  130. -O  causes A86 to produce an executable .COM file when the output 
  131.     file name extension is not explicitly given.
  132.  
  133. +S  suppresses the creation of the symbol-table (.SYM) file in 
  134.     normal (no errors) assembly.  This is overridden if you give 
  135.     an explicit symbols-file name in the invocation line.
  136.  
  137. -S  causes the symbol-table file to be created in all cases.
  138.  
  139. +X  causes A86 to require that undefined names be explicitly 
  140.     declared with an EXTRN when A86 is producing a linkable .OBJ 
  141.     file.  The X switch has no effect when A86 is making a .COM 
  142.     file.
  143.  
  144. -X  causes A86 to quietly assume that all undefined names are 
  145.     valid external references.
  146.     
  147. The default setting for all the switches is "minus".  Multiple 
  148. switches can be specified with a single sign; e.g. +OX is the 
  149. same as +O+X.
  150.  
  151.  
  152.  
  153. The A86 Environment Variable
  154.  
  155. To allow you to customize A86, the assembler examines the 
  156. MS-DOS environment variable named "A86" when it is invoked.  If 
  157. there is such a variable, its contents are inserted before the 
  158. invocation command tail, as if you had typed them yourself.
  159.  
  160. For example, if you execute the command SET A86=+OX while in DOS 
  161. (typically in the AUTOEXEC.BAT file run when the computer is 
  162. started), then the O and X siwtches will be "plus", unless 
  163. overridden with a "minus" setting in the command line.             
  164.  
  165. You may also include one or more file names in the A86 
  166. environment variable.  Those files will always be assembled 
  167. first, before the files you specify on the command line.  This 
  168. allows you to set up a library of macro definitions, which will 
  169. always be automatically available to your programs.  Thus, for 
  170. example, the DOS command  SET A86=C:\A86\MACDEF.8 +OX  will cause 
  171. both the O and X switches to default ON, but will also cause the 
  172. file MACDEF.8 of subdirectory A86 of drive C to always be 
  173. assembled.
  174.                                                           3-4
  175. Using Standard Input as a Command Tail
  176.  
  177. The following feature is a bit advanced.  If you're not familiar 
  178. with the practice of redirecting standard input, you may safely 
  179. skip this section.
  180.  
  181. A86 can also be configured to take its command arguments from 
  182. standard input, in addition to the invoaction command tail or the 
  183. A86 environment variable.  This allows A86 to be used in those 
  184. menu-driven systems that don't generate command tails for 
  185. programs.  It also allows other programs to create lists of files 
  186. to be assembled, then "pipe" the list to A86. 
  187.  
  188. Here's how the feature works: when the command argument A86 is an 
  189. ampersand &, A86 will prompt for standard input.  If the 
  190. ampersand is seen but there are other things following it, the 
  191. ampersand is ignored.
  192.  
  193. For example, you can place a list of file names and switch 
  194. settings into a file called FILELIST.  You can then invoke the 
  195. assembler via
  196.  
  197. A86 <FILELIST &
  198.  
  199. which will cause the contents of the FILELIST file to be used as 
  200. a command line.
  201.  
  202. You may place an ampersand at the end of your A86 environment 
  203. variable.  If you do so, then A86 will prompt for file names 
  204. whenever it is invoked without any command arguments (you type 
  205. A86 followed immediately by the ENTER key to the MS-DOS prompt).
  206. This is the mode used if you have a menu system that can't 
  207. generate an invocation command tail.
  208.  
  209. Note: when you redirect standard input so that it comes from a 
  210. file, A86 will read all the lines of the file (up to a limit of 
  211. 1023 bytes), and substitute spaces for the line breaks.  Thus you 
  212. may give the file names on individual lines, for readability.  
  213. However, if the feature is invoked manually (no redirection), so 
  214. that you are typing in the line after the prompt, A86 will take 
  215. the first line only.  You need to give all your switches and 
  216. files on that one line. 
  217.  
  218.  
  219.  
  220. Strategies for Source File Maintenance
  221.  
  222. A86 encourages modular programming, by letting you break your 
  223. source into separate files, with complete impunity.  A86 has no 
  224. concern whatsoever for file breaks-- it treats the sequence of 
  225. files as a single source code stream.  
  226.  
  227. You should consider one or more of the following strategies, 
  228. which I have adopted in my source file management: 
  229.                                                           3-5
  230. 1. I name all my A86 source files with the same extension, which 
  231.    is found on no other files. The particular extension I have 
  232.    chosen is ".8". I did not choose the more common .ASM; because 
  233.    I have a few source-files designed for MSDOS's assembler.  If 
  234.    you don't like .8, I would suggest .A86.  
  235.  
  236. 2. I keep a separate sub-directory on my hard disk for each 
  237.    multi-source-file A86 program I have.  Then the simple command 
  238.    "A86 *.8" performs the assembly for the current directory's 
  239.    program.  
  240.  
  241. 3. I exploit the fact that A86 expands wild-cards into 
  242.    alphabetical order.  Whenever I want a source-file to be 
  243.    assembled first (e.g., when it contains variable 
  244.    declarations), I append a decimal digit to the start of the 
  245.    file name: 0 for the first file, 1 for the second, etc., for 
  246.    however many files that need to be explicitly ordered.  If a 
  247.    file needs to come last, I append a "Z" to the start of the 
  248.    file name.  
  249.  
  250.    To accommodate this strategy, I have programmed A86 to a 
  251.    somewhat complicated algorithm for determining the default 
  252.    output file-name.  I use the name of the first source file; 
  253.    but I truncate the first character if it is a decimal digit.  
  254.    However, you may have a general-purpose file that must come 
  255.    first; so I have provided the following exception: if you have 
  256.    a source-file whose name begins with the digit "9", that name 
  257.    (without the 9) is used.  If you don't like this, you can 
  258.    always explicitly give the program name you want: "A86 *.8 
  259.    MYPROG".  
  260.  
  261.  
  262.  
  263. System Requirements for A86
  264.  
  265. A86 requires MS-DOS V2.00 or later.  No BIOS or lower-level calls 
  266. are made by A86, so A86 should run on any MS-DOS machine.  Please 
  267. let me know if you find this not to be the case.  
  268.  
  269. To achieve its blazing speed, A86 is something of a memory hog. 
  270. A86 allocates separate segments for itself, its stack, its source 
  271. file, and its output file.  A86 itself now occupies about 20K; it 
  272. always takes a full 64K for the stack.  A86 splits the remaining 
  273. available memory between its source file and its output file.  It 
  274. allocates a minimum of 8K apiece; and a maximum of 64K apiece.   
  275. Thus A86 requires at least 100K; but it will consume up to 212K if 
  276. available.  
  277.  
  278. Careful reading of the above paragraph reveals that in a small-
  279. memory system A86 severely limits the size of source files.  But 
  280. remember that this doesn't hurt you badly: you can split up 
  281. source files with impunity.  A86 assembles a sequence of files as 
  282. if it were a single source stream (similar to the INCLUDE 
  283. facility of other assemblers).  
  284.  
  285.